package javabase.concurrent;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class ReadWriteLockUsage {

    private final ReadWriteLock lock = new ReentrantReadWriteLock();
    private final Lock rLock = lock.readLock();
    private final Lock wLock = lock.writeLock();

    public void read() {
        rLock.lock();
        try {

        } finally {
            rLock.unlock();
        }
    }

    public void write() {
        wLock.lock();
        try {

        } finally {
            wLock.unlock();
        }
    }
}
